<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQhCdkeyGroupsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('qh_cdkey_groups', function (Blueprint $table) {
            $table->id();
            $table->string('title')->comment('标题');
            $table->string('channel')->nullable()->comment('渠道');
            $table->dateTime('expires')->nullable()->comment('过期时间');
            $table->integer('count', false, true)->default(1)->comment('生成数量');
            $table->integer('courseId', false, true)->index()->nullable()->comment('学科ID');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE qh_cdkey_groups comment '激活码组'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qh_cdkey_groups');
    }
}
